//--------------------------------------------------------------------------------
// This file is a portion of the PracticeEngine Rendering Engine.  It is distributed
// under the MIT License, available in the root of this distribution and 
// at the following URL:
//
// http://www.opensource.org/licenses/mit-license.php
//
// Copyright (c) Ferdinand Li 
//--------------------------------------------------------------------------------
#ifndef Camera_h__
#define Camera_h__

#include "PEMath.h"
#include <stdlib.h>

namespace PracEng
{
	class Camera
	{
	public:
		Camera();

		virtual void Tick(double DeltaTime);
		virtual void Move(PEVector3& moveDelta);
		virtual void Rotate(PEFloat2& rotDelta);

		virtual void SetViewParams(PEVector3* pEyePt, PEVector3* pLookatPt, PEVector3* pLookUp = NULL);
		virtual void SetProjParames(float fFOV, float fAspect, float fNearPlane, float fFarPlane);

		inline const PEMatrix* GetViewMatrix() const
		{
			return &mView;
		}
		inline const PEMatrix* GetProjectMatrix() const
		{
			return &mPerspective;
		}
		inline const PEVector3* GetEyeLoc() const
		{
			return &mEyeLocation;
		}
		inline const PEVector3* GetCamUp() const
		{
			return &mWorldUp;
		}
		inline const PEVector3* GetCamToward() const
		{
			return &mWorldAhead;
		}
		inline float GetAspectRatio() const
		{
			return fAspectRatio;
		}
		inline float GetNearClip() const
		{
			return fNearPlane;
		}
		inline float GetFarClip() const
		{
			return fFarPlane;
		}
		inline float GetFOV() const
		{
			return fFov;
		}

		PEMatrix mView;
		PEMatrix mPerspective;
		PEMatrix mWorldViewPerspective;
		PEVector3 mEyeLocation;

		PEVector3 mWorldUp;
		PEVector3 mWorldAhead;
		PEVector4 mWorldMoveDelta;

		PEVector3 mMoveDelta;
		PEMatrix mCamRot;

		float fFov;
		float fAspectRatio;
		float fNearPlane;
		float fFarPlane;

		float m_fCameraYawAngle;
		float m_fCameraPitchAngle;

	};


	class FreeCam : public Camera
	{

	};
}
#endif // Camera_h__
